<template>
    <div class="home">
        <el-menu
            :default-active="defaultActive"
            class="el-menu-demo"
            mode="horizontal"
            router
        >
            <el-menu-item index="/salesman">salesman</el-menu-item>
            <el-menu-item index="/project">project</el-menu-item>
        </el-menu>
        <div id="microapp"></div>
    </div>
</template>

<script>
import { microAppStart } from '../microRouter';
export default {
    mounted() {
        microAppStart();
    },
    watch: {
        $route: {
            handler: function(newVal) {
                console.log('main', newVal);
                this.defaultActive = `/${newVal.path.split('/')[1]}`;
                console.log(this.defaultActive);
            },
            immediate: true,
        },
    },
};
</script>

<style></style>
